package makabakaquestionnaire.zutsoftware.framework.email;

import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;


@Service
public class EmailServiceImpl implements EmailService {

    @Async("taskExecutor")
    @Override
    public void sendEmail(SendEmailModel model) {
        try{
            // 异步执行
            Thread.sleep(1000);
           // String textBody = EmailUtil.convertTextModel(EmailType.getByCode(emailKey),"wjf","hzy");
            // 发送文本邮件
            EmailUtil.sendEmail01(model.getReceiver(), model.getTitle(),model.getTextBody());
            // 发送复杂邮件:文本+图片+附件
            String body = "网络图片：<img src='https://freebrio.oss-cn-shanghai.aliyuncs.com/t/avatar.jpg'/>";
            // EmailUtil.sendEmail02(model.getReceiver(),"文本+图片+附件",body);
        } catch (Exception e){
            e.printStackTrace();
        }

    }
}